#!/bin/bash
# 下载golang
wget https://studygolang.com/dl/golang/go1.19.1.linux-amd64.tar.gz
# 解压sudo
tar -C /usr/local -zxvf  go1.19.1.linux-amd64.tar.gz

# 创建环境变量
mkdir -p $HOME/GoPath/src
mkdir -p $HOME/GoPath/pkg
mkdir -p $HOME/GoPath/bin

echo "export GOROOT=/usr/local/go;
export GOPATH=\$HOME/GoPath;
export GOBIN=\$GOPATH/bin;
export GOPROXY=https://goproxy.cn,direct;
export PATH=\$PATH:\$GOROOT/bin:\$GOBIN" >>  $HOME/.profile

source $HOME/.profile

# 创建软链接
#sudo ln -s /usr/local/go/bin/* /usr/bin/

